package system;

import java.util.ArrayList;

public class Tile {

	double x;
	double  y;
	Tiles tile;
	int nr;
	ArrayList<ActionPoint> points = new ArrayList<ActionPoint>() ;
	
	public Tile(double x, double y,Tiles t){
		this.x = x;
		this.y = y;
		tile = t;
		
		nr = (int)( Math.random()*12) +1 ;
	}

	
	
	public ArrayList<ActionPoint> getPoints() {
		return points;
	}



	public void addPoint(ActionPoint p){
		points.add(p);
	}
	
	public void setTile(Tiles t){
		this.tile = t;
	}
	
	public void setTile(Tiles t, int n){
		this.tile = t;
		this.nr = n;
	}
	
	public Tiles getTile(){
		return tile;
	}
	
	public double getX() {
		return x;
	}

	public double getY() {
		return y;
	}

	public int getNr() {
		return nr;
	}
	
	@Override
	public String toString(){
		return "(" + x + "," + y + ")";
	}
	@Override
	public boolean equals(Object o){
		if (! (o instanceof Tile))
			return false;
			else{
				boolean b1 = Math.abs(((Tile)o).getX() - x) < 0.4;
				boolean b2 =  Math.abs(((Tile)o).getY() - y) < 0.4;
				return(b1 && b2);
			}
	}
	
}
